class DashboardController < ApplicationController
  layout 'company',:except=>['custom_logs']

  def index
    if @cur_user.account_owner?
      @projects = @cur_user.company.active_projects 
    elsif @cur_user.supper?
      url = request.subdomains
      url = url.join(".") if url.size > 1
      @company = Company.find(:first,:conditions=>["url = ?",url])
      @projects = @company.active_projects    
    else
      @projects = @cur_user.active_projects    
    end
    @page_title = "Dashboard".t
  end
  def custom_logs
    if @cur_user.supper?
      url = request.subdomains
      url = url.join(".") if url.size > 1
      @company = Company.find(:first,:conditions=>["url = ?",url])
      @projects = @company.active_projects    
    elsif @cur_user.account_owner?
      @projects = @cur_user.company.active_projects 
    else
      @projects = @cur_user.active_projects    
    end
  end
end
